# -*- coding: utf-8 -*-
# created on 2016/12/19

from mathsolver.functions.base import BaseFunction, new_latex
from mathsolver.functions.base import BaseValue
from mathsolver.functions.hanshu.helper import huajian


class ChuDengHanShuJiSuan(BaseFunction):
    """基本初等函数计算"""

    def solver(self, *args):
        expr = args[0].sympify()
        if not expr.free_symbols:
            # 如果不含符号，计算
            res = expr.evalf()
        else:
            # 如果含符号，化简
            res = huajian(expr)

        self.steps.append(["", "%s = %s" % (new_latex(expr), new_latex(res))])
        self.output.append(BaseValue(res))
        self.label.add("基本初等函数计算")
        return self


if __name__ == '__main__':
    pass
